<template>
  <div class="box7">
    <div class="title">
      <p>年度游客量对比</p>
      <img src="../../images/dataScreen-title.png" alt="" />
    </div>
    <div class="charts" ref="chartsRef"></div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue";
import * as echarts from "echarts";
const chartsRef = ref();

onMounted(() => {
  const myCharts = echarts.init(chartsRef.value);
  // 一个容器可以展示多种类型的图形图表
  myCharts.setOption({
    title: {
      text: "散点图",
      left: "center",
      textStyle: {
        color: "yellowgreen",
      },
    },
    xAxis: {
      type: "category",
      show: true,
    },
    yAxis: {
      show: false,
    },
    grid: {
      left: 40,
      right: 20,
      bottom: 30,
      top: 30,
    },
    series: {
      type: "scatter",
      data: [
        23, 35, 45, 65, 75, 85, 34, 105, 44, 88, 34, 23, 65, 42, 44, 22, 56, 99,
        66, 77, 11,
      ],
      // 标记图形的设置
      symbol: "circle",
      symbolSize: 16,
      // label 图文标签
      label: {
        show: true,
        position: "top",
        color: "yellowgreen",
      },
      // 散点图标记的颜色
      itemStyle: {
        color: "skyblue",
      },
    },
  });
});
</script>

<style scoped lang="scss">
.box7 {
  width: 100%;
  height: 100%;
  background: url(../../images/dataScreen-main-cb.png) no-repeat;
  background-size: 100% 100%;
  margin-top: 10px;

  .title {
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    margin-left: 5px;

    p {
      font-size: 16px;
      color: #ffffff;
    }

    img {
      width: 80px;
      height: auto;
    }
  }

  .charts {
    height: calc(100% - 40px);
  }
}
</style>
